package com.algrithom.other;

/**
 * 781. 森林中的兔子
 */
public class Solution1 {
    
    public int numRabbits(int[] answers){
        int[] m = new int[1000];
        int result = 0;
        for (int i : answers) {
            if (m[i] > 0) {
                m[i]--;
            } else {
                m[i] = i;
                result += i + 1;
            }
        }
        return result;
    }
}